import request from "@/utils/request";

/**
 *提交个人认证
 * @returns
 */
export const submitAttestation = async (data = {}) => {
    return await request.post("/sxnf_user/user/update_user", data).then((res) => {
        return res;
    });
};

// 用户信息
export const getUserInfo = async () => {
    return await request.get("/sxnf_user/user/user_detail_info").then((res) => {
        return res;
    });
};
// // 修改用户信息
// export const editorUserInfo = async (data = {}) => {
//     return await request.put("/api/user/update", data).then((res) => {
//         return res;
//     });
// };
// 修改用户信息
export const editorUserInfo = async (data = {}) => {
    return await request.put("/sxnf_user/user/update", data).then((res) => {
        return res;
    });
};
// 获取首页服务菜单列表
export const serveMenuList = async (data = {}) => {
    return await request.get("/api/system/indexMenu/list", data).then((res) => {
        return res;
    });
};
// 收藏服务列表
export const bookmarks = async (data = {}) => {
    return await request.get("/api/system/indexMenu/bookmarks", data).then((res) => {
        return res;
    });
};
// 首页菜单收藏排序
export const reorder = async (data = {}) => {
    return await request.get("/api/system/indexMenu/reorder", data).then((res) => {
        return res;
    });
};
// 修改用户名
export const setUserNickName = async (data: string) => {
    return await request.put(`/sxnf_user/user/modify_nickname?nickName=${data}`).then((res) => {
        return res;
    });
};
// 获取修改信息验证码
export const getUpdateMsgCode = async (data = {}) => {
    return await request.get("/sxnf_user/user/sendValidationCode", data).then((res) => {
        alert(`验证码：${res.data}`);
        return res;
    });
};
// 验证验证码是否正确
export const verificationCodePhone = async (data: number | string) => {
    return await request.get(`/sxnf_user/user/validationCode?validateCode=${data}`).then((res) => {
        return res;
    });
};
// 修改绑定手机号
export const updateUsersPhone = async (data = {}) => {
    return await request.put("/sxnf_user/user/modify_phone", data).then((res) => {
        return res;
    });
};
// 重置密码
export const updateUsersPassword = async (data = {}) => {
    return await request.put("/sxnf_user/user/modify_password", data).then((res) => {
        return res;
    });
};
// 设置个人联系地址
export const updateUsersAddress = async (data = {}) => {
    return await request.put("/sxnf_user/user/modify_address", data).then((res) => {
        return res;
    });
};
// 获取注销账号验证码
export const sendCancelValidateCode = async (data = {}) => {
    return await request.get("/sxnf_user/user/sendCancelValidateCode", data).then((res) => {
        alert(`验证码：${res.data}`);
        return res;
    });
};
// 注销账号
export const unsubscribe = async (data = {}) => {
    return await request.post("/sxnf_user/user/updateCancelUser", data).then((res) => {
        return res;
    });
};
